{extend name='layout' /}
{block name='title'}
留言首页-后台管理
{/block}

{block name="content"}
<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">留言管理</div>
  <!-- Table -->
  <table class="table">
    <thead>
        <tr>
          <th>id</th>
          <th>用户名</th>
          <!-- <th>父id</th> -->
          <!-- <th>uid</th> -->
          <th>内容</th>
          <th>标志</th>
          <th>时间</th>
          <th>审核</th>
          <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {volist name='list' id='message'}
        <tr>
          <td>{$message.mid}</td>
          <td>{$message.user_name}</td>
          <!-- <td>{$message.parent_id}</td> -->
            <!-- <td>{$message.uid}</td> -->
          <td>{$message.content}</td>
          <td>{$message.act_flag}</td>
          <td>{$message.time|date='Y-m-d H:m:s',###}</td>
            <td>
                <a href="javascript:passMsg('__HTP____URL__/admin/message/pass/mid/{$message.mid}')">通过</a>
            </td>
          <td>
            <a href="javascript:delMsg('__HTP____URL__/admin/message/delete/mid/{$message.mid}')">删除</a>
          </td>
        </tr>
        {/volist}
    </tbody>
  </table>
</div>
<script type="text/javascript">
    function passMsg(url){
        $.ajax({
            url:url,
            data:{},
            type:"GET",
            dataType:"JSON",
            success: function(data){
                if(data){
                    // 刷新页面
                    location.reload();
                }
            }
        })
    }
  function delMsg(url){
    if (window.confirm("请确认是否删除")){
          $.ajax({
            url:url,
            data:{},
            type:"GET",
            dataType:"JSON",
            success: function(data){
                if(data){
                  // 刷新页面
                  location.reload();
                }
            }
        })
      }
  }
</script>
<nav aria-label="Page navigation">  
{$page}
</nav>
{/block}